package cn.charlotte.pit.util.command.util;

import cn.charlotte.pit.util.command.CommandHandler;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.*;

public class ItemUtil {

    public static ItemStack get(final String input, final int amount) {
        final ItemStack item = get(input);

        if (item != null) {
            item.setAmount(amount);
        }

        return item;
    }

    public static ItemStack get(final String input) {
        if (Material.getMaterial(input) == null) {
            return null;
        }
        return new ItemStack(Material.getMaterial(input));
    }

}
